<template>
  <div class="headerTop warp">
    <div class="logobar">
      <img src="../assets/img/indexLogo.6f8ac4f0.png" alt="" />
    </div>
    <!--  中间文字 -->
    <ul>
      <li
        :class="{ btn: $route.path === '/home' }"
        @click="$router.push('/home')"
      >
        首页
      </li>
      <li
        :class="{ btn: $route.path === '/goods' }"
        @click="$router.push('/goods')"
      >
        全部商品
      </li>
      <li
        :class="{ btn: $route.path === '/user' }"
        @click="$router.push('/user')"
      >
        个人中心
      </li>
      <li
        :class="{ btn: $route.path === '/order' }"
        @click="$router.push('/order')"
      >
        我的订单
      </li>
      <li
        :class="{ btn: $route.path === '/free' }"
        @click="$router.push('/free')"
      >
        专属福利
      </li>
    </ul>
    <div class="searchBox">
      <input type="text" placeholder="请输入关键字" v-model="serchInput" />
      <span class="span" @click="serch">
        <img src="../assets/img/search.png" alt="" />
      </span>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      serchInput: "",
    };
  },
  methods: {
    serch() {
      console.log(this.serchInput);
      this.$router.push(`/goods?keyword=${this.serchInput}`);
    },
  },
};
</script>

<style scoped lang="less">
.headerTop {
  height: 118px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  ul {
    width: 500px;
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    cursor: pointer;
    list-style: none;
    .btn {
      color: blue;
    }
  }
  .searchBox {
    display: flex;
    text-align: center;
    line-height: 40px;
    input {
      width: 214px;
      height: 40px;
      border: 1px solid #dedede;
      border-radius: 20px 0px 0px 20px;
      padding-left: 19px;
      outline: none;
    }
    .span {
      width: 50px;
      height: 40px;
      background: #0a328e;
      display: inline-block;
      border-radius: 0px 20px 20px 0px;
      cursor: pointer;
    }
  }
}
</style>